from django.db import models
from user.models import OrdinaryUser

class Comment(models.Model):
    DEFAULT_PK = 1
    created_time = models.DateTimeField(auto_now_add=True, verbose_name='发布时间')
    content = models.CharField(max_length=512, verbose_name='内容')
    owner = models.ForeignKey(OrdinaryUser, verbose_name='发布者', on_delete=models.CASCADE)  # 1条评论属于某个用户，1个用户会有多条评论

    class Meta:
        verbose_name = verbose_name_plural = '评论'


    def __str__(self):
        return self.content[:20] + "..."  # 只展示前20个字符




